package com.eagle.print.service.impl;

import java.util.List;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.eagle.commons.vo.invUseDic;
import com.eagle.print.service.ConsumesQueryService;

import sun.awt.AppContext;

public class BirtFactory {

	private static BirtFactory instance;
	
	//public static final ServletContext servletContext = AppContextLoader.getInstance().getServletContext();
	 //ServletContext application = getServletContext();
	

	static ServletContext servletContext = ServletActionContext.getServletContext(); 
	public static final ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
	
	
	

	//private static ApplicationContext context = AppContext.CONTEXT;

	private final ConsumesQueryService cq = (ConsumesQueryService) context.getBean("consumesQueryService");

	

	public static BirtFactory getInstance() {

	if (instance == null) {

	 

	   instance = new BirtFactory();

	}

	return instance;

	}

	public List<invUseDic> getInvUse() throws Exception{
		//	ConsumesQueryDaoImpl cdao=new ConsumesQueryDaoImpl();
			return cq.getInvUse(1, "2014-08");
		}

	

}
